package com.zx.auth.block.repository.custom;

import com.zx.auth.block.modle.OAuth2AuthorizationConsent;
import com.zx.auth.block.param.OAuth2AuthorizationConsentParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Optional;

/**
 * <p>
 * description: OAuth2授权同意自定义仓库接口 <br>
 * create: 2025-11-13 10:40
 * </p>
 *
 * @author
 */
public interface OAuth2AuthorizationConsentCustomRepository {
    /**
     * 根据条件分页查询授权同意
     *
     * @param consentParam 查询条件
     * @param pageable     分页对象
     * @param tenantId     租户ID
     * @return 授权同意分页结果
     */
    Page<OAuth2AuthorizationConsent> findAuthorizationConsentsByPage(OAuth2AuthorizationConsentParam consentParam, Pageable pageable, String tenantId);

    /**
     * 根据注册客户端ID、主体名称和租户ID查找授权同意信息
     *
     * @param registeredClientId 注册客户端ID
     * @param principalName      主体名称
     * @param tenantId           租户ID
     * @return 授权同意信息
     */
    Optional<OAuth2AuthorizationConsent> findByRegisteredClientIdAndPrincipalNameAndTenantId(String registeredClientId, String principalName, String tenantId);
}